<%= javascript_include_tag "calenderJS" -%>

<style>
/*
calender
*/
#calender {border-top:1px solid #fff; padding-top:0.5em}
.calender { width:auto; height:180px;}
.calender ul {list-style-type:none; margin:0; padding:0;}
.calender .day { height:20px;}
.calender .day li,.calender .date li{ float:left; width:14%; height:23px; line-height:23px; text-align:center}
.calender li a { text-decoration:none; font-family:Tahoma; font-size:11px !important; color:#333}
.calender li a:hover { color:#f30; text-decoration:underline}
.calender li a.hasArticle {font-weight:bold; color:#f60 !important}
.lastMonthDate, .nextMonthDate {color:#999;font-size:11px}
.selectThisYear a, .selectThisMonth a{text-decoration:none; margin:0 2px;  font-weight:bold}
.calender .LastMonth { float:left; text-decoration:none;  font-size:14px; font-weight:bold}
.calender .NextMonth { float:right; text-decoration:none; font-size:14px; font-weight:bold}
.calenderBody {clear:both}
.calenderTitle {text-align:center;height:20px; line-height:20px; clear:both}
.today { border:1px solid #ccc; padding:1px; text-decoration:none}
.calenderBottom {clear:both; border-top:1px solid #ddd; padding: 1px 0; text-align:right}
.calenderBottom a {text-decoration:none; font-size:11px;}
.calenderBottom span {color:#999; font-size:10px; margin-right:20px}
.b_font {font-weight:bold;color:green;font-size:13px}
</style>

<DIV id=sidebars>
<br><br><br>
<P id=explanation>寻找对您重要的事情, 实现目标, 分享您的经过. 写在您的<%="app_title".t%> . </P>
<!--openID-->
<div id="openid">
<%unless session[:user].nil?%>
  <%if current_user.login == params[:id]%>
          <%if current_user.openid_url.nil?%>
          绑定我的帐号到openid
          <%=form_remote_tag(:update=>"openid",:url=>{:controller=>:auth,:action=>:openid})%>
              <input type="text" id="openid_url" name="openid_url">
              <input type="submit" name='submit' value="提交">
          <%=end_form_tag%>
          <%else%>
            我的openID：<%=current_user.openid_url%>
          <%end%>
  <%end%>    
  <%end%>
</div>
<!--日历-->
<H3>我的日历</H3>
<div id = "current_year" style="display:none"><%=Time.now.year%></div>
<div id = "current_month" style="display:none"><%=Time.now.month%></div>
<div id="things_day" style="display:none"><%=@array_a%></div>
<div id="calender"></div>
<script>

function change_bak(){
   array_str = document.getElementById("things_day").innerText
   year = document.getElementById("current_year").innerHTML
   month = document.getElementById("current_month").innerHTML
    var array_a = array_str.split(",")
    j = 0
    for(i=0;i<31;i++)
        {
            if(array_a[j]==i)
                {
                    j++;
                    try{
                        document.getElementById("calender_"+i).innerHTML = "<a href='/things/search/"+year+"-"+month+"-"+i+"?&type=t&user=<%=params[:id]%>''><div class='b_font' >"+i+"</div></a>"
                       }catch(e){} 
                   if(i ==<%=Time.now.day%>&&year==<%=Time.now.year%>&&month==<%=Time.now.month%>)
                    {
                     try{
                        document.getElementById("calender_"+i).innerHTML = "<a href='/things/search/"+year+"-"+month+"-"+i+"?&type=t&user=<%=params[:id]%>''><div class='b_font' style='background-color: #cccccc;'>"+i+"</div></a>"
                       }catch(e){} 
                    }
  
                }

        }
}
  $("calender").innerHTML = HS_calender(new Date())
change_bak()
function ajax_cander(flag){
    year = Number($("current_year").innerHTML)
    month = Number($("current_month").innerHTML)
    if(flag=="n")
    {
        month =1 + month
        if(month>12){
          month=month-12
          year = year + 1
        }
    }else
    {
        month = month - 1
        if(month==0){
          month=12
          year = year - 1
        }
    }
    $("current_year").innerHTML = year
    $("current_month").innerHTML = month
    new Ajax.Updater('things_day', '/user/things_day/<%=params[:id]%>?&year='+year+'&month='+month, {asynchronous:true, evalScripts:true, onComplete:function(request){change_bak()}}); return false;
}
</script>

<H3 class=near-person-links>热门人物</H3>
<UL>
<%= render :partial => '/partial/top_user',:locals=>{:user_lists=>@user_lists} %>
  <H5 class=seeall>→ <A href="#">更多</A></H5></LI></UL>

<H3 class=near-person-links>热门目标</H3>
<UL>
<%= render :partial => '/partial/top_thing',:locals=>{:things=>@top_things} %>

  <H5 class=seeall>→ <A 
  href="#">更多</A></H5></LI></UL>

</DIV>
<DIV id=main>
<DIV id=welcomeblock><A href="/user/view/<%=params[:id]%>"><IMG 
id=person height=75 src="/images/default_profile_image.jpg" 
width=75></A> 
<H1>Hello, <%=@user.login%>!</H1>
<H2><A href="#">我有<%=@user.thingsusers_count%> 个目标</A></H2>
</DIV>
<DIV id=introblock>
<H1>给自己定一个目标?/许下自己的愿望?</H1>
<FORM action=/things/add method=post>
<FIELDSET>
<DIV id=biggoalfield><%= text_field_with_auto_complete :thing,:title %></DIV><INPUT type=submit value="我 要 实 现 它  "> </FIELDSET> 
</FORM><BR>
<SCRIPT type=text/javascript>
    document.getElementById('thing_title').focus();
</SCRIPT>
 </DIV>
<DIV class=goalsoup>
<H2>和我的目标相关的记录:</H2> 
<%for thing in @things%>
<DIV class=entry>
<DIV class=aggregatedperson><A href="">
<IMG id="" height=75 src="/images/default_profile_image.jpg" width=75>
<P><A href="/people/view/shinhwaamy"></A><BR></P>
</DIV>
<H4><STRONG><A href="/things/view/<%=thing.id%>"><%=thing.title%></A></STRONG> <SPAN>(<A href="/people/progress/shinhwaamy/5480">查看全部1条进度</A>)</SPAN> </H4>

<!--<H5><A href="/entries/view/22670">一起努力</A> &nbsp;&nbsp;40分钟前 </H5>-->
<DIV class=entrybody>
  <P>我在 <%=fmt_time(thing.updated_at,"") unless thing.updated_at.nil?%> 添加这个事件。</P>
  <p>还有 <a href="/things/view/<%=thing.id%>"><b><%=thing.thingsusers_count -1%></b></a> 人和我一样同样要做这件事</p>
</DIV>
<P class=entry-metadata><SPAN></SPAN> | <A href="/things/view/<%=thing.id%>#comments">评论</A><br><br><br><br><br><br></P></DIV>
<%end%>
<%= will_paginate @things %>

</div>
<DIV class=goalsoup>

<H5><%="app_title".t%>是一个可以分享你目标的地方.</H5><%="app_title".t%>最有趣的地方并不在于记下要做的。而在于它能根据您所写的，为您聚合出一类人来。聚合出这些想做相同事情的人来后，剩下的就由用户自己去发挥了。比如大家可以相互鼓励，可以互相帮助，互相建议，甚至可以一同完成，总之，人们会发现自己朝向一个目标前行的时候不再孤独了。 

<P></P></DIV></DIV>